extension StringExtension on String{
  String format(dynamic value) => replaceAll('%', '$value');
  bool equals(String str) => compareTo(str) == 0;
  String formatParams(List<dynamic> params) {
    int index = 0;
    return replaceAllMapped('%', (m){
      return '${params[index++]}';
    });
  }
  String formatTime(int min){
    int hour = min % 60;
    List<int> list = [hour, min];
    int index = 0;
    return replaceAllMapped('%', (m){
      return '${list[index++]}';
    });
  }
  int get toInt {
   return int.parse(replaceAll(RegExp(r'\D'), ''));
  }

  double get toDouble{
    return double.parse(replaceAll(r'[^0-9.]', ''));
  }
}

extension StringOrNullExtension on String?{
  String get s => this??"";
}